home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 March: Technology Seed / Mac Tech Seed Mar '97.toast / Tempo a2c5 / Software / Software Installers / ARA Client Install / Modem CCLs / PSI PowerModem III⁄IV / PSI PowerModem III_IV
Encoding:
Text File  |  1996-05-24  |  7.6 KB  |  395 lines

  1. !  PSI PowerModem III & IV  7/26/93  SDH
  2. !
  3. !  'mlts' resource info for this modem:
  4. !    byte 1 == 01 -> modem HAS builtin reliability protocols
  5. !    byte 2 == 00 -> reserved by Apple
  6. !    byte 3 == 21 -> max hex chars in varstr 7 (33 dec)
  7. !    byte 4 == 21 -> max hex chars in varstr 8
  8. !    byte 5 == 21 -> max hex chars in varstr 9
  9. !
  10. @ORIGINATE
  11. @ANSWER
  12. !
  13. ! Set up the modem - label range is 1-10
  14. !
  15. ! Mac talks to the modem at 19200 bps.  
  16. serreset 19200, 0, 8, 1
  17. !
  18. ! reset serial port for hardware options
  19. HSReset 0 0 0 0 0 0
  20. !
  21. settries 0
  22. ! pause to give the modem time to power up
  23. pause 20
  24. !
  25. @LABEL 1
  26. flush
  27. matchclr
  28. matchstr 1 3 "OK\13\10"
  29. ! &f  - recall factory settings
  30. ! &d0 - ignore DTR from DTE
  31. ! &k3 - enable CTS/RTS flow control
  32. ! w2  - Connect result code reports modem speed
  33. ! \k0 - Enter command state but do not send break
  34. ! \j0 - Disable auto port rate adjust
  35. ! s7=120 - To allow for an international call
  36. ! S0=0 - Don't answer calls
  37. ! E0   - Turn command echo off
  38. ! \N3 - v42 autoreliable mode
  39. ! %C0 - compression disabled
  40. ! S95=12 - (dec) gives PROTOCOL: and CARRIER result codes
  41. write "AT&f&d0&k3w2\\k0\\j0s7=120S0=0E0\\n3%C0S95=12\13"
  42. matchread 30
  43. inctries
  44. iftries 2 71
  45. ! Modem is not responding, send a short break.
  46. SBreak
  47. jump 1
  48. !
  49. @LABEL 3
  50. ! Modem responding & configured.
  51. ! Determine if reliable link is requested.
  52. !
  53. ! If modem mnp10 link requested (var 4 == 2) then jump label 4
  54. ! If modem v42 link requested (var 4 == 1) then jump label 5
  55. ! If no modem v42 link requested (var 4 == 0) [same as ARA 1.0] then jump label 9
  56. !
  57. ifstr 4 4 "2"
  58. ifstr 4 5 "1"
  59. ifstr 4 9 "0"
  60. !
  61. ! Else invalid value in var 4, exit with error
  62. jump 76
  63. !
  64. !
  65. @LABEL 4
  66. ! Reliable MNP10 link is requested
  67. note "This modem does not support MNP 10." 3
  68. pause 20
  69. note "Please contact PSI technical support." 3
  70. pause 20
  71. jump 7
  72. !
  73. @LABEL 5
  74. ! Reliable v42 link is requested.  OK for LAP-M -> MNP 4.
  75. matchclr
  76. matchstr 1 7 "OK\13\10"
  77. ! \N3 - v42 autoreliable mode
  78. write "AT\\N3\13"
  79. matchread 300
  80. jump 71
  81. !
  82. @LABEL 7
  83. ! If we DID support compression in the modem, this is where it would go.
  84. !
  85. @LABEL 9
  86. ! If speaker on flag is true, jump to label 13.  Else turn off the speaker.
  87. ifstr 2 13 "1"
  88. pause 5
  89. matchclr
  90. matchstr 1 13 "OK\13\10"
  91. write "ATM0\13"
  92. matchread 30
  93. jump 71
  94. !
  95. ! Modem ready, so enable answer or dial mode - label range is 11-30
  96. ! Determine if answer or originate mode.
  97. !
  98. @LABEL 13
  99. pause 5
  100. ifANSWER 62
  101. !
  102. ! Dial type dispatch
  103. !
  104. ! Normal dialing (parm 6 == 0) jump to 19
  105. ! Blind  dialing (parm 6 == 1) jump to 17
  106. ! Manual dialing (parm 6 == 2) jump to 15 
  107. !
  108. ifstr 6 19 "0"
  109. ifstr 6 17 "1"
  110. ifstr 6 15 "2"
  111. !
  112. ! Else invalid value in var 6, exit with error
  113. jump 76
  114. !
  115. @label 15
  116. ASK 2 "Pick up the phone & dial ^1.  Hit OK when the phone rings, then hangup." 80
  117. note "Manual dialing initiated..." 3
  118. ! X1 to ignore dialtone & busy for manual dialing, D to dial
  119. write "ATX1D \13"
  120. jump 32
  121. !
  122. @label 17
  123. note "Dialing without dialtone." 3
  124. matchclr
  125. matchstr 1 19 "OK\13\10"
  126. ! X1 to ignore dialtone & busy for blind dialing
  127. write "ATX1\13"
  128. matchread 30
  129. jump 71
  130. !
  131. ! This is where we break up long dialstrings - label range is 19 - 27.
  132. !
  133. @label 19
  134. ! Parameter 1 contains the full dialstring from the connection document.
  135. ! Parameter 3 contains "P" for pulse & "T" for tone dialing.
  136. ! Parameters 7, 8 & 9 contain the dial string broken up into
  137. ! lengths which the modem's command buffer can handle as defined
  138. ! by the 'mlts' resource.
  139. !
  140. note "Dialing ^1." 3
  141. !
  142. ! If parm 8 is blank goto sending parm 7 only
  143. ! else send parm 7 with semicolon
  144. ifstr 8 25 " "
  145. !
  146. matchclr
  147. matchstr 1 21 "OK\13\10"
  148. write "ATD^3^7;\13"
  149. matchread 400
  150. jump 71
  151. !
  152. ! If parm 9 is blank goto sending param 8
  153. ! else send param 8 with semicolon & param 9
  154. @label 21
  155. ifstr 9 27 " "
  156. !
  157. matchclr
  158. matchstr 1 23 "OK\13\10"
  159. write "ATD^3^8;\13"
  160. matchread 400
  161. jump 71
  162. !
  163. ! Send final parameter string then wait for
  164. ! connect message.
  165. !
  166. @label 23
  167. write "ATD^3^9\13"
  168. jump 32
  169. !
  170. @label 25
  171. write "ATD^3^7\13"
  172. jump 32
  173. !
  174. @label 27
  175. write "ATD^3^8\13"
  176. jump 32
  177. !
  178. !    Connecting - label range is 31-60
  179. !
  180. @LABEL 32
  181. matchclr
  182. matchstr 1  34 "CONNECT 1200\13\10"
  183. matchstr 2  35 "CONNECT 2400\13\10"
  184. matchstr 3  36 "CONNECT 4800\13\10"
  185. matchstr 4  37 "CONNECT 7200\13\10"
  186. matchstr 5  38 "CONNECT 9600\13\10"
  187. matchstr 6  39 "CONNECT 12000\13\10"
  188. matchstr 7  40 "CONNECT 14400\13\10"
  189. !
  190. matchstr 8  68 "RING\13\10"
  191. matchstr 9  72 "NO DIALTONE\13\10"
  192. matchstr 10  73 "NO CARRIER\13\10"
  193. matchstr 11  73 "ERROR\13\10"
  194. matchstr 12 74 "BUSY\13\10"
  195. matchstr 13 75 "NO ANSWER\13\10"
  196. !
  197. matchstr 14 44 "PROTOCOL: NONE\13\10"
  198. !matchstr ? 45 "PROTOCOL: MNP\13\10"
  199. !matchstr ? 46 "PROTOCOL: MNP2\13\10"
  200. !matchstr ? 47 "PROTOCOL: MNP3\13\10"
  201. matchstr 15 48 "PROTOCOL: MNP\13\10"
  202. matchstr 16 49 "PROTOCOL: LAP-M\13\10"
  203. matchstr 17 50 "PROTOCOL: ALT - CELLULAR\13\10"
  204. !
  205. matchread 1200
  206. ! If in ANSWER mode, loop back.
  207. ! else if in ORIGINATE, the modem has timed out.
  208. ifANSWER 32
  209. jump 71
  210. !
  211. !  This modem has been setup to do CTS handshaking,
  212. !  and we assume that a CTS handshaking cable is being used,
  213. !  so we leave the serial port set to 19,200 bps.
  214. !
  215. @LABEL 34
  216. note "Communicating at 1200 bps." 2
  217. CommunicatingAt 1200
  218. jump 58
  219. !
  220. @LABEL 35
  221. note "Communicating at 2400 bps." 2
  222. CommunicatingAt 2400
  223. jump 58
  224. !
  225. @LABEL 36
  226. note "Communicating at 4800 bps." 2
  227. CommunicatingAt 4800
  228. jump 58
  229. !
  230. @LABEL 37
  231. note "Communicating at 7200 bps." 2
  232. CommunicatingAt 7200
  233. jump 58
  234. !
  235. @LABEL 38
  236. note "Communicating at 9600 bps." 2
  237. CommunicatingAt 9600
  238. jump 58
  239. !
  240. @LABEL 39
  241. note "Communicating at 12000 bps." 2
  242. CommunicatingAt 12000
  243. jump 58
  244. !
  245. @LABEL 40
  246. note "Communicating at 14400 bps." 2
  247. CommunicatingAt 14400
  248. jump 58
  249. !
  250. ! Reliable link connections.
  251. ! Tell ARA with USERHOOK 2 that a reliable modem link has been established.
  252. !
  253. @LABEL 44
  254. ! no reliable link established
  255. jump 32
  256. !
  257. @LABEL 45
  258. note "MNP reliable link established." 3
  259. userhook 2
  260. jump 32
  261. !
  262. @LABEL 46
  263. note "MNP2 reliable link established." 3
  264. userhook 2
  265. jump 32
  266. !
  267. @LABEL 47
  268. note "MNP3 reliable link established." 3
  269. userhook 2
  270. jump 32
  271. !
  272. @LABEL 48
  273. note "MNP reliable link established." 3
  274. userhook 2
  275. jump 32
  276. !
  277. @LABEL 49
  278. note "LAP-M reliable link established." 3
  279. userhook 2
  280. jump 32
  281. !
  282. @LABEL 50
  283. note "MNP10 reliable link established." 3
  284. userhook 4
  285. jump 32
  286. !
  287. @LABEL 58
  288. ! set serial port for hardware CTS handshake
  289. HSReset 0 1 0 0 0 0
  290. !
  291. ! Connection established. In ORIGINATE mode pause before exit.
  292. !
  293. ifANSWER 59
  294. pause 30
  295. @LABEL 59
  296. exit 0
  297. !
  298. ! @ANSWER
  299. ! Set the modem to answer on 1st ring - label range is 61-70
  300. !
  301. @LABEL 62
  302. matchclr
  303. matchstr 1 32 "OK\13\10"
  304. write "ATS0=1\13"
  305. matchread 30
  306. jump 71
  307. !
  308. ! RING entry point
  309. ! If ORIGINATE mode return to waiting for input.
  310. ! Else claim the serial port and return.
  311. !
  312. @LABEL 68
  313. ifORIGINATE 32
  314. userhook 1
  315. note "Answering call..." 2
  316. jump 32
  317. !
  318. ! Error messages - label range is 71-100
  319. !
  320. ! Modem Not Responding
  321. @LABEL 71
  322. exit -6019
  323. !
  324. ! No Dial Tone
  325. @LABEL 72
  326. exit -6020
  327. !
  328. ! No Carrier or Error
  329. @LABEL 73
  330. exit -6021
  331. !
  332. ! Busy
  333. @LABEL 74
  334. exit -6022
  335. !
  336. ! No Answer
  337. @LABEL 75
  338. exit -6023
  339. !
  340. ! varstring invalid value
  341. @LABEL 76
  342. exit -6027
  343. !
  344. @LABEL 80
  345. exit -6008
  346. !
  347. ! Hang up the modem - label range is 101-120
  348. !
  349. @HANGUP
  350. @LABEL 102
  351. flush
  352. settries 0
  353. HSReset 0 0 0 0 0 0
  354. @LABEL 105
  355. !
  356. ! Drop the modem into command mode with a short break.
  357. ! Repeat hangup command and escape sequence 3 times max.
  358. !
  359. SBreak
  360. @LABEL 108
  361. pause 10
  362. flush
  363. matchclr
  364. matchstr 1 111 "NO CARRIER\13\10"
  365. matchstr 2 111 "OK\13\10"
  366. matchstr 3 111 "ERROR\13\10"
  367. write "ATH\13"
  368. matchread 30
  369. inctries
  370. iftries 3 71
  371. ! no response, try escape sequence
  372. matchclr
  373. matchstr 1 108 "OK\13\10"
  374. pause 11
  375. write "+++"
  376. pause 11
  377. matchread 15
  378. jump 105
  379. !
  380. ! Recall factory settings.
  381. !
  382. @LABEL 111
  383. pause 15
  384. matchclr
  385. matchstr 1 114 "OK\13\10"
  386. write "AT&f\13"
  387. matchread 30
  388. jump 71
  389. !
  390. @LABEL 114
  391. exit 0
  392. !
  393. ! Labels 121-128 are reserved for future emergency hacks
  394. !